#include "SeqStack.cpp"

class Person {
public:
    string name;
    int age;

    Person(const string &name, int age) : name(name), age(age) {}
};

int main() {
    //创建栈
    SeqStack<Person>* stack = new SeqStack<Person>();
    //创建数据
    Person p1("aaa",18);
    Person p2("bbb",19);
    Person p3("ccc",20);
    Person p4("ddd",21);
    Person p5("eee",22);

    //入栈
    stack->Push_SeqStack(&p1);
    stack->Push_SeqStack(&p2);
    stack->Push_SeqStack(&p3);
    stack->Push_SeqStack(&p4);
    stack->Push_SeqStack(&p5);

    //输出
    while (stack->Size_SeqStack() > 0) {
        //出栈
        Person* person = (Person *) stack->Pop_SeqStack();
        cout<<"Name:"<<person->name<<"\t"<<"Age:"<<person->age<<endl;
    }

    cout<<stack->IsEmpty()<<endl;

    stack->FreeSpace_SeqStack();

    return 0;
}